package com.deercrowing.takeaway.dao;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import com.deercrowing.takeaway.entity.DishFlavorEntity;
import org.apache.ibatis.annotations.Select;

import java.util.List;


/**
 * 菜品口味关系表(DishFlavor)表数据库访问层
 *
 * @author guoyongxiang
 * @since 2024-07-16 16:01:03
 */
@Mapper
public interface DishFlavorMapper extends BaseMapper<DishFlavorEntity> {

    /**
     * 批量插入口味
     *
     * @param flavorEntityList
     */
    void insertBatch(List<DishFlavorEntity> flavorEntityList);

    /**
     * 删除菜品绑定口味
     *
     * @param dish_id
     */
    @Delete("delete from tb_dish_flavor where dish_id = #{dish_id}")
    void deleteByDishId(Short dish_id);

    /**
     * 搜索菜品绑定的口味
     *
     * @param dish_id
     * @return
     */
    @Select("select * from tb_dish_flavor where dish_id = #{dish_id}")
    List<DishFlavorEntity> selectListByDishId(Integer dish_id);
}

